COMMON={
    show_datetimepicker: function(selector) {
        if (typeof selector == 'undefined' ) {
            selector = '.datetimepicker';
        }
        $(selector).datetimepicker();
    },
    /**
    * @params
    */
    upload: function(params) {
        var configs = [];
        var configs = $.parseJSON(params);
        if (configs != null) {
            if (typeof configs.selector == "undefined")
                configs.selector = '.fFile';
            if (typeof configs.filetype == "undefined")
                configs.filetype = '*.*';
            if (typeof configs.selector_value == "undefined")
                configs.selector_value = '#uploaded';
            if (typeof configs.selector_show == "undefined")
                configs.selector_show = '#show';
            if (typeof configs.type == "undefined")
                configs.type = '';
            if (typeof configs.param == "undefined")
                configs.param = '';
        } else {
            alert('Params is null');
        }
        $(configs.selector).uploadify({
            'fileTypeExts' : configs.filetype,
            'swf' : configs.base_url + 'assets/js/upload/uploadify.swf',
            'uploader' : configs.base_url + 'upload.php?type=' + configs.type + configs.param,
            'multi': false,
            'onUploadSuccess' : function(file, data, response) {
                if (response == true && data != '') {
                    $(configs.selector_value).val(data);
                    $(configs.selector_show).html('<img style="max-width: 80px" src="' + configs.path_uploaded + '/' + data + '" alt="' + data + '" />');
                } else {
                    alert('File uploaded error.');
                }
            }
       });
  }
};